﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AresControls;
using System.Data;

public partial class HGridX : System.Web.UI.Page
{
    public HGrid gridItemsGrid;

    protected void Page_Load(object sender, EventArgs e)
    {
        
    }

    private void Page_PreRender(object sender, System.EventArgs e)
    {
        if (!IsPostBack)
        {
            DataSet ds = Hipocrate.DB.DBConnection.GetData("Test_Select", new string[] { }, new object[] { });
            DataView dv0 = ds.Tables[1].DefaultView;

            gridItemsGrid.Source = ds.Tables[0].DefaultView;
        }

        gridItemsGrid.GenerateGrid();

    }

    override protected void OnInit(EventArgs e)
    {
        gridItemsGrid = new HGrid();
        gridItemsGrid.Height = "232px";
        plc.Controls.Add(gridItemsGrid);

        HInput hI1 = new HInput();
        hI1.ID = "id";
        hI1.Width = "10";
        hI1.DataSrc = "ID";
        hI1.Style = "display: block";

        HInput hS2 = new HInput();
        hS2.ID = "name";
        hS2.Width = "20";
        hS2.DataSrc = "name";
        hS2.Style = "display: block";

        gridItemsGrid.HControls = new HControl[] { hI1, hS2 };
        gridItemsGrid.HeaderText = new string[] { "ID", "NAME" };
        gridItemsGrid.SortColumns = new bool[] { false, false };
        gridItemsGrid.Paging = true;
        gridItemsGrid.Searching = true;
        gridItemsGrid.SearchColumns = new bool[] { false, false };
        //gridItemsGrid.Language = ((PageBase)Page).Session_Language;
        //gridItemsGrid.XmlFile = Request.ApplicationPath + "/Resources/StringTables/Tools/Tools.xml";
        gridItemsGrid.InvokeOnChangeLine = "OnChangeLine_MasterGrid();";
        gridItemsGrid.InvokeOnDeleteLine = "OnDeleteLine_MasterGrid();";
        gridItemsGrid.InvokeOnDeleteNewLine = "OnDeleteLine_MasterGrid();";
        gridItemsGrid.InvokeOnDeleteAllLines = "OnDeleteLine_MasterGrid();";
        gridItemsGrid.InvokeOnInsertBlankRow = "OnAddNewLine_MasterGrid();";
        gridItemsGrid.InvokeOnRefreshGrid = "OnRefreshGrid_MasterGrid();";
        gridItemsGrid.UniqueValueColumns = new bool[] { false, false };
    }

    private void InitializeComponent()
    {
        this.Load += new System.EventHandler(this.Page_Load);
        this.PreRender += new System.EventHandler(this.Page_PreRender);
    }
}